{% extends "base.html" %}
{% block page_title %}myPrefix{% endblock %}
{% block content %}
	<ul id="nav">
	  <li><a href="/defence/" title="My Alarms">My Alarms</a><span>/</span></li>
	  <li><a href="/defence/myPrefix" title="My Prefixs">My Prefixs</a><span>/</span></li>
	  <li><a href="/defence/myASN" title="My ASNs">My ASNs</a><span>/</span></li>
	  <li><a href="/account/profile/" title="My Account">My Account</a><span>/</span></li>
	</ul><!--end nav--><!-- class="current" class="anews"-->
	
	{% if msg %}
	<div class="notice">
		<p class="warn">{{msg}}</p>
	</div>
	{% endif %}
	
	<div id="featured-projects">
    <h4 align="center">My Prefixs</h4>
	<div>
      <form action="/defence/myPrefix/" method="post">{% csrf_token %}
            <input type="submit" value="add prefix">
            prefix: <input type="text" name="prefix" />
            {% if error %}
              <font color="red">
                IPv4: A.B.C.D/M (0&le;M&le;32),
                IPv6: A:B:C::/M (0&le;M&le;128)
              </font>
            {% endif %}
      </form>
    </div>
    <br/>
    <table>
      <tr><td>
        <table>
          <head><tr><th>#</th></tr></head>
          <body>{% for prefix in Prefixs %}<tr><td align=right>{{ forloop.counter }}</td></tr>{% endfor %}</body>
        </table>
      </td>
      <td>
        <table id="alarms" class="tablesorter">
          <thead>
            <tr>
              <th>Time (UTC)</th>
              <!--<th>Timestamp</th>-->
              <th>IP Prefix</th>
              <!--<th>RPKI</th>-->
              <th>Operation</th>
            </tr>
          </thead>
          <tbody>
          {% for prefix in Prefixs %}
            <tr>
              <td>{{ prefix.time|date:"Y-m-d H:i:s" }}</td>
              <!--<td>{{ alarm.0.time }}</td>-->
              <td>
                <a href="http://bgp.he.net/net/{{ prefix.dec }}" target="_blank">{{ prefix.dec }}</a>
              </td>
              <!--<td align=right>{{ alarm.0.rpki }}</td>-->
              <form action="/defence/myPrefix/"  method="post">{% csrf_token %}
			  <input type="hidden" name="deletePrefixId" value="{{prefix.id}}" />
              <td><input type="submit" value="delete"></td>
			  </form>
            </tr>
          {% endfor %}
          </tbody>
        </table>
      </td></tr>
    </table>
  </div><!--end featured-projects-->
{% endblock %}
{% block js_script %}
  <script src="/static/jquery-latest.js"></script>
  <script type="text/javascript" src="/static/jquery.tablesorter.js"></script>
  <script type="text/javascript">
    $(document).ready(function(){ 
        $("#alarms").tablesorter();
      }
    );
  </script>
{% endblock %}